package shun.demo.remote.display.server;


import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import shun.demo.remote.display.model.Movement;
import shun.demo.remote.display.model.Property;
import shun.demo.remote.display.model.TimeSync;

/**
 * Created by chen on 14-5-9.
 */
public class SendHandler extends Handler {

    public static final int MESSAGE_SEND = 1;
    public static final int MESSAGE_MOVEMENT = 2;
    private Clients mClients;

    public SendHandler(Clients clients, Looper looper) {
        super(looper);
        mClients = clients;
    }

    @Override
    public void handleMessage(Message msg) {
        switch (msg.what) {
            case MESSAGE_SEND:
                mClients.send((Property) msg.obj);
                break;
            case MESSAGE_MOVEMENT:
                mClients.forwardMovement((Movement) msg.obj);
                break;
        }
    }
}
